package com.betterjr.modules.commission.entity;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.betterjr.common.entity.BetterjrEntity;
import com.betterjr.common.mapper.CustDateJsonSerializer;
import com.betterjr.common.mapper.CustTimeJsonSerializer;
import com.betterjr.common.selectkey.SerialGenerator;
import com.betterjr.common.utils.BetterDateUtils;
import com.betterjr.modules.account.entity.CustOperatorInfo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Access(AccessType.FIELD)
@Entity
@Table(name = "t_cps_payment_code")
public class CommissionBusPaymentCode implements BetterjrEntity {

    /**
     * 
     */
    private static final long serialVersionUID = 1143695028967271394L;

    // 编号
    @Id
    @Column(name = "ID", columnDefinition = "INTEGER")
    private Long id;

    // 支付编号
    @Column(name = "C_PAYMENTNO", columnDefinition = "VARCHAR")
    private String paymentNo;

    // 银行全称
    @Column(name = "C_BANK_FULL_NAME", columnDefinition = "VARCHAR")
    private String bankFullName;

    // 银行简称
    @Column(name = "C_BANK_SHORT_NAME", columnDefinition = "VARCHAR")
    private String bankShortName;

    // 导入日期
    @Column(name = "C_IMPORT_DATE", columnDefinition = "VARCHAR")
    @JsonSerialize(using = CustDateJsonSerializer.class)
    private String importDate;

    // 导入具体时分秒
    @Column(name = "C_IMPORT_TIME", columnDefinition = "VARCHAR")
    @JsonSerialize(using = CustTimeJsonSerializer.class)
    private String importTime;

    /*
     * 操作员ID
     */
    @Column(name = "L_REG_OPERID", columnDefinition = "INTEGER")
    private Long regOperId;

    @Column(name = "C_REG_OPERNAME", columnDefinition = "VARCHAR")
    private String regOperName;
    /*
     * 操作员所在机构
     */
    @Column(name = "C_OPERORG", columnDefinition = "VARCHAR")
    private String operOrg;

    @Column(name = "D_REG_DATE", columnDefinition = "VARCHAR")
    @JsonSerialize(using = CustDateJsonSerializer.class)
    private String regDate;

    @Column(name = "T_REG_TIME", columnDefinition = "VARCHAR")
    @JsonSerialize(using = CustTimeJsonSerializer.class)
    private String regTime;

    @Column(name = "L_MODI_OPERID", columnDefinition = "INTEGER")
    private Long modiOperId;

    @Column(name = "C_MODI_OPERNAME", columnDefinition = "VARCHAR")
    private String modiOperName;

    @Column(name = "D_MODI_DATE", columnDefinition = "VARCHAR")
    @JsonSerialize(using = CustDateJsonSerializer.class)
    private String modiDate;

    @Column(name = "T_MODI_TIME", columnDefinition = "VARCHAR")
    @JsonSerialize(using = CustTimeJsonSerializer.class)
    private String modiTime;

    @Column(name = "L_FILE_ID", columnDefinition = "VARCHAR")
    private Long fileId;

    @Column(name = "N_BATCHNO", columnDefinition = "VARCHAR")
    private Long batchNo;

    // 判断生成的文件是否有效，0表示无效，1表示有效；
    @Column(name = "L_FILE_VALID", columnDefinition = "VARCHAR")
    private Long fileValid;

    public Long getId() {
        return id;
    }

    public void setId(Long anId) {
        id = anId;
    }

    public String getPaymentNo() {
        return paymentNo;
    }

    public void setPaymentNo(String anPaymentNo) {
        paymentNo = anPaymentNo;
    }

    public String getBankFullName() {
        return bankFullName;
    }

    public void setBankFullName(String anBankFullName) {
        bankFullName = anBankFullName;
    }

    public String getBankShortName() {
        return bankShortName;
    }

    public void setBankShortName(String anBankShortName) {
        bankShortName = anBankShortName;
    }

    public String getImportDate() {
        return importDate;
    }

    public void setImportDate(String anImportDate) {
        importDate = anImportDate;
    }

    public String getImportTime() {
        return importTime;
    }

    public void setImportTime(String anImportTime) {
        importTime = anImportTime;
    }

    public Long getRegOperId() {
        return regOperId;
    }

    public void setRegOperId(Long anRegOperId) {
        regOperId = anRegOperId;
    }

    public String getRegOperName() {
        return regOperName;
    }

    public void setRegOperName(String anRegOperName) {
        regOperName = anRegOperName;
    }

    public String getOperOrg() {
        return operOrg;
    }

    public void setOperOrg(String anOperOrg) {
        operOrg = anOperOrg;
    }

    public String getRegDate() {
        return regDate;
    }

    public void setRegDate(String anRegDate) {
        regDate = anRegDate;
    }

    public String getRegTime() {
        return regTime;
    }

    public void setRegTime(String anRegTime) {
        regTime = anRegTime;
    }

    public Long getModiOperId() {
        return modiOperId;
    }

    public void setModiOperId(Long anModiOperId) {
        modiOperId = anModiOperId;
    }

    public String getModiOperName() {
        return modiOperName;
    }

    public void setModiOperName(String anModiOperName) {
        modiOperName = anModiOperName;
    }

    public String getModiDate() {
        return modiDate;
    }

    public void setModiDate(String anModiDate) {
        modiDate = anModiDate;
    }

    public String getModiTime() {
        return modiTime;
    }

    public void setModiTime(String anModiTime) {
        modiTime = anModiTime;
    }

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long anFileId) {
        fileId = anFileId;
    }

    public Long getBatchNo() {
        return batchNo;
    }

    public void setBatchNo(Long anBatchNo) {
        batchNo = anBatchNo;
    }

    public Long getFileValid() {
        return fileValid;
    }

    public void setFileValid(Long anFileValid) {
        fileValid = anFileValid;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (bankFullName == null ? 0 : bankFullName.hashCode());
        result = prime * result + (bankShortName == null ? 0 : bankShortName.hashCode());
        result = prime * result + (batchNo == null ? 0 : batchNo.hashCode());
        result = prime * result + (fileId == null ? 0 : fileId.hashCode());
        result = prime * result + (fileValid == null ? 0 : fileValid.hashCode());
        result = prime * result + (id == null ? 0 : id.hashCode());
        result = prime * result + (importDate == null ? 0 : importDate.hashCode());
        result = prime * result + (importTime == null ? 0 : importTime.hashCode());
        result = prime * result + (modiDate == null ? 0 : modiDate.hashCode());
        result = prime * result + (modiOperId == null ? 0 : modiOperId.hashCode());
        result = prime * result + (modiOperName == null ? 0 : modiOperName.hashCode());
        result = prime * result + (modiTime == null ? 0 : modiTime.hashCode());
        result = prime * result + (operOrg == null ? 0 : operOrg.hashCode());
        result = prime * result + (paymentNo == null ? 0 : paymentNo.hashCode());
        result = prime * result + (regDate == null ? 0 : regDate.hashCode());
        result = prime * result + (regOperId == null ? 0 : regOperId.hashCode());
        result = prime * result + (regOperName == null ? 0 : regOperName.hashCode());
        result = prime * result + (regTime == null ? 0 : regTime.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        final CommissionBusPaymentCode other = (CommissionBusPaymentCode) obj;
        if (bankFullName == null) {
            if (other.bankFullName != null) return false;
        } else if (!bankFullName.equals(other.bankFullName)) return false;
        if (bankShortName == null) {
            if (other.bankShortName != null) return false;
        } else if (!bankShortName.equals(other.bankShortName)) return false;
        if (batchNo == null) {
            if (other.batchNo != null) return false;
        } else if (!batchNo.equals(other.batchNo)) return false;
        if (fileId == null) {
            if (other.fileId != null) return false;
        } else if (!fileId.equals(other.fileId)) return false;
        if (fileValid == null) {
            if (other.fileValid != null) return false;
        } else if (!fileValid.equals(other.fileValid)) return false;
        if (id == null) {
            if (other.id != null) return false;
        } else if (!id.equals(other.id)) return false;
        if (importDate == null) {
            if (other.importDate != null) return false;
        } else if (!importDate.equals(other.importDate)) return false;
        if (importTime == null) {
            if (other.importTime != null) return false;
        } else if (!importTime.equals(other.importTime)) return false;
        if (modiDate == null) {
            if (other.modiDate != null) return false;
        } else if (!modiDate.equals(other.modiDate)) return false;
        if (modiOperId == null) {
            if (other.modiOperId != null) return false;
        } else if (!modiOperId.equals(other.modiOperId)) return false;
        if (modiOperName == null) {
            if (other.modiOperName != null) return false;
        } else if (!modiOperName.equals(other.modiOperName)) return false;
        if (modiTime == null) {
            if (other.modiTime != null) return false;
        } else if (!modiTime.equals(other.modiTime)) return false;
        if (operOrg == null) {
            if (other.operOrg != null) return false;
        } else if (!operOrg.equals(other.operOrg)) return false;
        if (paymentNo == null) {
            if (other.paymentNo != null) return false;
        } else if (!paymentNo.equals(other.paymentNo)) return false;
        if (regDate == null) {
            if (other.regDate != null) return false;
        } else if (!regDate.equals(other.regDate)) return false;
        if (regOperId == null) {
            if (other.regOperId != null) return false;
        } else if (!regOperId.equals(other.regOperId)) return false;
        if (regOperName == null) {
            if (other.regOperName != null) return false;
        } else if (!regOperName.equals(other.regOperName)) return false;
        if (regTime == null) {
            if (other.regTime != null) return false;
        } else if (!regTime.equals(other.regTime)) return false;
        return true;
    }

    @Override
    public String toString() {
        return "CommissionBusPaymentCode [id=" + id + ", paymentNo=" + paymentNo + ", bankFullName=" + bankFullName
                + ", bankShortName=" + bankShortName + ", importDate=" + importDate + ", importTime=" + importTime
                + ", regOperId=" + regOperId + ", regOperName=" + regOperName + ", operOrg=" + operOrg + ", regDate="
                + regDate + ", regTime=" + regTime + ", modiOperId=" + modiOperId + ", modiOperName=" + modiOperName
                + ", modiDate=" + modiDate + ", modiTime=" + modiTime + ", fileId=" + fileId + ", batchNo=" + batchNo
                + ", fileValid=" + fileValid + "]";
    }

    public void initAddValue(final CustOperatorInfo anOperator) {
        this.regDate = BetterDateUtils.getNumDate();
        this.regTime = BetterDateUtils.getNumTime();
        this.importDate = BetterDateUtils.getNumDate();
        this.importTime = BetterDateUtils.getNumTime();
        this.regOperId = anOperator.getId();
        this.regOperName = anOperator.getName();
        this.operOrg = anOperator.getOperOrg();
        this.setId(SerialGenerator.getLongValue("CommissionBusPaymentCode.id"));
    }

    public void initModifyValue(CustOperatorInfo anOperator) {
        this.modiDate = BetterDateUtils.getNumDate();
        this.modiTime = BetterDateUtils.getNumTime();
        this.modiOperId = anOperator.getId();
        this.modiOperName = anOperator.getName();
    }
}
